package com.zhonglz.commons.base;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zhonglz.util.result.ResultUtils;

/****
 * 公共请求配置
 * @author xiaozhong
 *
 */
@Controller
public class GlobalController {
	
	/****
	 * 会话过期或会话令牌无效
	 * @param errorName
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/error/userError401")
	public ResultUtils userError401(String errorName) {
		ResultUtils result=new ResultUtils();
		result.setCode(ResultUtils.CODE_USER_ERROR);
		result.setMsg("令牌过期或无效，请重新登陆");
		return result;
	}
	
	/****
	 * 会话过期或会话令牌无效
	 * @param errorName
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/error/userError400")
	public ResultUtils userError400(String errorName) {
		ResultUtils result=new ResultUtils();
		result.setCode(ResultUtils.CODE_USER_ERROR400);
		result.setMsg("请确认请求携带了令牌Token");
		return result;
	}
	
	/***
	 * 测试项目页面
	 * @return
	 */
	@RequestMapping("/")
	public String index() {
		
		return "index";
	}

}
